(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/script/Scan.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, 'bfd34eIpaNDEKWXNaq43kDD', 'Scan', __filename);
// script/Scan.js

"use strict";

cc.Class({
    extends: cc.Component,

    properties: {
        player: cc.Node,
        robot: cc.Node
    },

    // onLoad () {},

    start: function start() {
        this.speed = cc.v2(0, 10);
    },


    onBeginContact: function onBeginContact(contact, selfCollider, otherCollider) {
        if (otherCollider.tag === 88) {
            this.tracking();
        }
    },

    tracking: function tracking() {
        var pos1 = this.robot.convertToWorldSpaceAR(cc.v2(0, 0));
        var pos2 = this.player.convertToWorldSpaceAR(cc.v2(0, 0));
        var pos = pos2.sub(pos1);
        var v = pos.normalize().mul(5);
        // this.robot.x += pos.x;
        // this.robot.y += pos.y;
        console.log(pos);
        var active = cc.moveBy(1, cc.v2(pos.x, pos.y));
        this.robot.runAction(active);
        var angle = Math.atan(v.x / v.y) / Math.PI * 180;
        //this.robot.rotation = angle;
    }
}

//update(dt) {},

);

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=Scan.js.map
        